package wyklad;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Przekierowanie extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      doPost(request, response);
	}  	

   protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      response.sendRedirect("http://www.mimuw.edu.pl/~sroka");
      //response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Wstyd� si�");
      
      //przekierowanie HTTP mo�na wykona� jedynie przed zatwierdzeniem wyj�cia 
      //PrintWriter pw = response.getWriter();
      //pw.print("<html><head></head><body>Witaj �wiecie!</body></html>");
      //pw.flush();
      //to wywo�anie zg�osi java.lang.IllegalStateException
      //response.sendRedirect("http://www.mimuw.edu.pl/~sroka");
   }   	  	    
}